home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / bstfiles.zoo / authordate2.bst < prev    next >
Text File  |  1992-06-27  |  30KB  |  1,311 lines

  1. %  This BibTeX 0.99 style file is intended for documents that use the
  2. %  author-date citation system.  It should be used in conjunction with the
  3. %  authordate1-4.sty (or equivalent) LaTeX style-option.
  4. %
  5. %  In deciding on the bibliography layout to be implemented, the following
  6. %  works have been consulted:
  7. %  1. British Standard 5605:  "Citing publications by bibliographic
  8. %         references", 1978.
  9. %  2. British Standard 1629:  "Bibliographic references", 1976.
  10. %     (Note:  There is now a 1989 edition.)
  11. %  3. "Copy-editing" by Judith Butcher, Cambridge University Press, 1981.
  12. %  4. "The Oxford Dictionary for Writers and Editors", Oxford University
  13. %         Press, 1981 (for abbreviations).
  14. %  5. "The Chicago Manual of Style", Chicago University Press, 1982.
  15. %
  16. %  Discretion has been used in certain matters.  In particular:
  17. %  - Titles are italic except when there is a "contribution title" and
  18. %    a "main publication title", in which case the "contribution title"
  19. %    is roman while the "main publication title" is italic.
  20. %  - When there is a PUBLISHER, it is assumed that ADDRESS contains "place of
  21. %    publication";  output is of the form "place-of-publication: publisher".
  22. %    When there is an ORGANIZATION as well as a PUBLISHER, output is of the
  23. %    form "place-of-publication: publisher, for organization".  Otherwise,
  24. %    it is assumed that ADDRESS is a postal address, and output is of the
  25. %    form "institution, address", "organization, address", "school, address"
  26. %    or "howpublished, address".
  27. %  - If there is a MONTH but no VOLUME or NUMBER for a journal-article, the
  28. %    MONTH is used on the assumption that it contains information that is
  29. %    equivalent to VOLUME or NUMBER.  MONTH is ignored for other documents
  30. %    that have a PUBLISHER, but output after YEAR for anything else.
  31. %  - When CHAPTER and/or PAGES are specified with INBOOK, it is assumed that
  32. %    these fields are being used to pick out particular pages of interest
  33. %    (as an alternative to using the optional [...] argument of \cite);
  34. %    the information is put at the very end of the entry, in line with BS 1629.
  35. %    When CHAPTER and/or PAGES are specified for INCOLLECTION or INPROCEEDINGS,
  36. %    it is assumed that the fields are being used to specify the location of
  37. %    the part/article of interest; the information is put before the
  38. %    BOOKTITLE, in line with Chicago's treatment of "parts" and "chapters".
  39. %  - Since "volume" can be used in various ways (see page 219 of Butcher),
  40. %    this file assumes that, when there is a SERIES, any VOLUME and NUMBER
  41. %    refer to position in the SERIES (i.e. Butcher's meaning 4).
  42. %    If there is a VOLUME but no SERIES, it is assumed that VOLUME refers
  43. %    to a volume within a particular work (i.e. Butcher's meaning 1, 2 or 3).
  44. %    For INPROCEEDINGS and INCOLLECTION, this information goes after the
  45. %    BOOKTITLE.  (If you prefer to have volume information before EDITOR,
  46. %    as on page 449 of Chicago, you can set TYPE = "Vol." with INCOLLECTION.)
  47. %
  48. %  This file differs from authordate1.bst, authordate3.bst and authordate4.bst
  49. %  in that:
  50. %  - Titles of journals, articles and boooks are "downstyle".  Apart from the
  51. %    first character, and the first character following : and white space,
  52. %    uppercase letters are converted to lowercase unless protected by {}.
  53. %  - Author's and editor's names are in roman.
  54. %
  55. %  The combination of authordate2.bst and authordate1-4.sty allows citations
  56. %  of the form \shortcite{bloggs-60} as well as the usual \cite{bloggs-60}.
  57. %  When
  58. %       ... \cite{bloggs-60} ... \shortcite{bloggs-60} ...
  59. %  appears in the input file,
  60. %       ... (Bloggs, 1960) ... (1960) ...
  61. %  appears in the final document.
  62. %
  63. %  This file was developed from apalike.bst.  It also uses code taken from
  64. %  acm.bst, aaai-named.bst, btxbst.doc, ieeetr.bst and siam.bst.
  65. %
  66. %                                                     David Rhead
  67. %                                                     Cripps Computing Centre
  68. %                                                     Nottingham University
  69. %                                                     March 1990
  70. %
  71.  
  72. ENTRY
  73.   { address
  74.     author
  75.     booktitle
  76.     chapter
  77.     edition
  78.     editor
  79.     howpublished
  80.     institution
  81.     journal
  82.     key
  83.     month
  84.     note
  85.     number
  86.     organization
  87.     pages
  88.     publisher
  89.     school
  90.     series
  91.     title
  92.     type
  93.     volume
  94.     year
  95.   }
  96.   {}
  97.   { label extra.label sort.label }
  98.  
  99. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  100.  
  101. FUNCTION {init.state.consts}
  102. { #0 'before.all :=
  103.   #1 'mid.sentence :=
  104.   #2 'after.sentence :=
  105.   #3 'after.block :=
  106. }
  107.  
  108. STRINGS { s t }
  109.  
  110. FUNCTION {output.nonnull}
  111. { 's :=
  112.   output.state mid.sentence =
  113.     { ", " * write$ }
  114.     { output.state after.block =
  115.     { add.period$ write$
  116.       newline$
  117.       "\newblock " write$
  118.     }
  119.     { output.state before.all =
  120.         'write$
  121.         { add.period$ " " * write$ }
  122.       if$
  123.     }
  124.       if$
  125.       mid.sentence 'output.state :=
  126.     }
  127.   if$
  128.   s
  129. }
  130.  
  131. FUNCTION {output}
  132. { duplicate$ empty$
  133.     'pop$
  134.     'output.nonnull
  135.   if$
  136. }
  137.  
  138. FUNCTION {output.check}
  139. { 't :=
  140.   duplicate$ empty$
  141.     { pop$ "empty " t * " in " * cite$ * warning$ }
  142.     'output.nonnull
  143.   if$
  144. }
  145.  
  146. FUNCTION {output.year.month.check}
  147. { year empty$
  148.     { "empty year in " cite$ * warning$ }
  149.     { add.period$ write$
  150.       month empty$
  151.         { " " year * extra.label * "." *
  152.           after.sentence 'output.state :=
  153.         }
  154.         { " " year * extra.label * " (" * month * ")." *
  155.           after.sentence 'output.state :=
  156.         }
  157.       if$
  158.     }
  159.   if$
  160. }
  161.  
  162. FUNCTION {output.year.check}
  163. { year empty$
  164.     { "empty year in " cite$ * warning$ }
  165.     { add.period$ write$
  166.       " " year * extra.label * "." *
  167.       after.sentence 'output.state :=
  168.     }
  169.   if$
  170. }
  171.  
  172. FUNCTION {output.bibitem}
  173. { newline$
  174.   "\bibitem[" write$
  175.   label write$
  176.   "]{" write$
  177.   cite$ write$
  178.   "}" write$
  179.   newline$
  180.   ""
  181.   before.all 'output.state :=
  182. }
  183.  
  184. FUNCTION {fin.entry}
  185. { add.period$
  186.   write$
  187.   newline$
  188. }
  189.  
  190. FUNCTION {new.block}
  191. { output.state before.all =
  192.     'skip$
  193.     { after.block 'output.state := }
  194.   if$
  195. }
  196.  
  197. FUNCTION {new.sentence}
  198. { output.state after.block =
  199.     'skip$
  200.     { output.state before.all =
  201.         'skip$
  202.         { after.sentence 'output.state := }
  203.       if$
  204.     }
  205.   if$
  206. }
  207.  
  208. FUNCTION {not}
  209. {   { #0 }
  210.     { #1 }
  211.   if$
  212. }
  213.  
  214. FUNCTION {and}
  215. {   'skip$
  216.     { pop$ #0 }
  217.   if$
  218. }
  219.  
  220. FUNCTION {or}
  221. {   { pop$ #1 }
  222.     'skip$
  223.   if$
  224. }
  225.  
  226. FUNCTION {new.block.checkb}
  227. { empty$
  228.   swap$ empty$
  229.   and
  230.     'skip$
  231.     'new.block
  232.   if$
  233. }
  234.  
  235. FUNCTION {field.or.null}
  236. { duplicate$ empty$
  237.     { pop$ "" }
  238.     'skip$
  239.   if$
  240. }
  241.  
  242. FUNCTION {boldface}
  243. { duplicate$ empty$
  244.     { pop$ "" }
  245.     { "{\bf " swap$ * "}" * }
  246.   if$
  247. }
  248.  
  249. FUNCTION {emphasize}
  250. { duplicate$ empty$
  251.     { pop$ "" }
  252.     { "{\em " swap$ * "}" * }
  253.   if$
  254. }
  255.  
  256. INTEGERS { nameptr namesleft numnames }
  257.  
  258. FUNCTION {format.names}
  259. { 's :=
  260.   #1 'nameptr :=
  261.   s num.names$ 'numnames :=
  262.   numnames 'namesleft :=
  263.     { namesleft #0 > }
  264.     { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't :=
  265.       nameptr #1 >
  266.         { namesleft #1 >
  267.             { ", " * t * }
  268.             { t "others" =
  269.                 { ", {\em et~al.}" * }
  270.                 { ", \& " * t * }                           %  Butcher, pages
  271.               if$                                           %  186-189.
  272.             }
  273.           if$
  274.         }
  275.         't
  276.       if$
  277.       nameptr #1 + 'nameptr :=
  278.       namesleft #1 - 'namesleft :=
  279.     }
  280.   while$
  281. }
  282.  
  283. FUNCTION {format.authors}
  284. { author empty$
  285.     { "" }
  286.     { author format.names }
  287.   if$
  288. }
  289.  
  290. FUNCTION {format.key}
  291. { empty$
  292.     { key field.or.null }
  293.     { "" }
  294.   if$
  295. }
  296.  
  297. FUNCTION {format.editors}
  298. { editor empty$
  299.     { "" }
  300.     { editor format.names
  301.       editor num.names$ #1 >                                %  Use ODWE abbrevs.
  302.         { " (eds)" * }                                      %  to avoid
  303.         { " (ed)" * }                                       %  ambiguity between
  304.       if$                                                   %  "editor" and
  305.     }                                                       %  "edition".
  306.   if$
  307. }
  308.  
  309. FUNCTION {format.title}                                     %  Howells example
  310. { title empty$                                              %  in BS 5605 comes
  311.     { "" }                                                  %  out wrong because
  312.     { title "t" change.case$ }                              %  Patashnik
  313.   if$                                                       %  capitalizes
  314. }                                                           %  after a colon.
  315.  
  316. FUNCTION {n.dashify}
  317. { 't :=
  318.   ""
  319.     { t empty$ not }
  320.     { t #1 #1 substring$ "-" =
  321.         { t #1 #2 substring$ "--" = not
  322.             { "--" *
  323.               t #2 global.max$ substring$ 't :=
  324.             }
  325.             {   { t #1 #1 substring$ "-" = }
  326.                { "-" *
  327.                  t #2 global.max$ substring$ 't :=
  328.                }
  329.               while$
  330.             }
  331.           if$
  332.         }
  333.         { t #1 #1 substring$ *
  334.           t #2 global.max$ substring$ 't :=
  335.         }
  336.         if$
  337.     }
  338.   while$
  339. }
  340.  
  341. FUNCTION {format.btitle}
  342. { title empty$
  343.    { "" }
  344.    { title "t" change.case$ emphasize }
  345.    if$
  346. }
  347.  
  348. FUNCTION {tie.or.space.connect}
  349. { duplicate$ text.length$ #3 <
  350.     { "~" }
  351.     { " " }
  352.   if$
  353.   swap$ * *
  354. }
  355.  
  356. FUNCTION {either.or.check}
  357. { empty$
  358.     'pop$
  359.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  360.   if$
  361. }
  362.  
  363. INTEGERS { multiresult }
  364.  
  365. FUNCTION {multi.page.check}
  366. { 't :=
  367.   #0 'multiresult :=
  368.     { multiresult not
  369.       t empty$ not
  370.       and
  371.     }
  372.     { t #1 #1 substring$
  373.       duplicate$ "-" =
  374.       swap$ duplicate$ "," =
  375.       swap$ "+" =
  376.       or or
  377.         { #1 'multiresult := }
  378.         { t #2 global.max$ substring$ 't := }
  379.       if$
  380.     }
  381.   while$
  382.   multiresult
  383. }
  384.  
  385. FUNCTION {format.numberinseries}
  386. { number empty$
  387.     { "" }
  388.     { number multi.page.check
  389.         { ", nos. " number n.dashify tie.or.space.connect }
  390.         { ", no. "  number tie.or.space.connect }
  391.       if$
  392.     }
  393.   if$
  394. }
  395.  
  396. FUNCTION {booklike.series.volume.number}                    %  Chicago, pages
  397. { series empty$                                             %  450-451.
  398.     { volume empty$
  399.       { " " }
  400.       { " Vol. " volume * }
  401.       if$
  402.     }
  403.     {
  404.       volume empty$
  405.         { number empty$
  406.             { series }
  407.             { series format.numberinseries * }
  408.           if$
  409.         }
  410.         { number empty$
  411.             { series ", vol. " volume * * }
  412.             { series ", vol. " * volume * format.numberinseries * }
  413.           if$
  414.         }
  415.       if$
  416.     }
  417.   if$
  418. }
  419.  
  420. FUNCTION {incollectionlike.series.volume.number}
  421. { series empty$
  422.     { volume empty$
  423.       { " " }
  424.       { " vol. " volume * }
  425.       if$
  426.     }
  427.     { new.block
  428.       volume empty$
  429.         { number empty$
  430.             { series }
  431.             { series format.numberinseries * }
  432.           if$
  433.         }
  434.         { number empty$
  435.             { series ", vol. " volume * * }
  436.             { series ", vol. " * volume * format.numberinseries * }
  437.           if$
  438.         }
  439.       if$
  440.     }
  441.   if$
  442. }
  443.  
  444. FUNCTION {format.edition}
  445. { edition empty$
  446.     { "" }
  447.     { output.state mid.sentence =
  448.         { edition "l" change.case$ " edn." * }
  449.         { edition "t" change.case$ " edn." * }
  450.       if$
  451.     }
  452.   if$
  453. }
  454.  
  455. FUNCTION {format.pages}
  456. { pages empty$
  457.     { "" }
  458.     { pages multi.page.check
  459.         { "" pages n.dashify tie.or.space.connect }
  460.         { "" pages tie.or.space.connect }
  461.       if$
  462.     }
  463.   if$
  464. }
  465.  
  466. FUNCTION {format.pagesinbook}                               %  By the time the
  467. { pages empty$                                              %  reader has read
  468.     { "" }                                                  %  address, pub'r,
  469.     { pages multi.page.check                                %  note (where the
  470.         { "Pages " pages n.dashify tie.or.space.connect }   %  note may end with
  471.         { "Page " pages tie.or.space.connect }              %  numbers), s/he
  472.       if$                                                   %  may not recognise
  473.     }                                                       %  a number-range as
  474.   if$                                                       %  meaning pages.
  475. }                                                           %  Avoid ambiguity
  476.                                                             %  (Butcher, p.181).
  477.  
  478. FUNCTION {format.vol.num.date.pages}
  479. { volume empty$
  480.    { month empty$
  481.        { "" }
  482.        { month }
  483.      if$
  484.    }
  485.     { volume boldface field.or.null
  486.         number empty$
  487.         { month empty$
  488.             'skip$
  489.             { "(" month * ")" *  * }
  490.           if$
  491.         }
  492.         { "(" number * ")" *  *
  493.             volume empty$
  494.             { "there's a number but no volume in " cite$ * warning$ }
  495.             'skip$
  496.           if$
  497.         }
  498.       if$
  499.     }
  500.   if$
  501.   pages empty$
  502.     'skip$
  503.     { duplicate$ empty$
  504.         { pop$ format.pages }
  505.         { ", " * pages n.dashify * }
  506.       if$
  507.     }
  508.   if$
  509. }
  510.  
  511. FUNCTION {format.chapter.pages.inbook}
  512. { chapter empty$
  513.     'format.pagesinbook
  514.     { type empty$
  515.         { "Chap." }
  516.         { type }
  517.       if$
  518.       chapter tie.or.space.connect
  519.       pages empty$
  520.         'skip$
  521.         { ", " * format.pagesinbook "l" change.case$ * }
  522.       if$
  523.     }
  524.   if$
  525. }
  526.  
  527. FUNCTION {format.chapter.pages.incoll}
  528. { chapter empty$
  529.     { pages empty$
  530.         { "{\em In:} " }
  531.         { "{\em " format.pagesinbook " of:} " * * }
  532.       if$
  533.     }
  534.     { type empty$
  535.         { "{\em Chap. " chapter * }
  536.         { "{\em " type * " " * chapter * }
  537.       if$
  538.       pages empty$
  539.         { " of:} " * }
  540.         { ", " * format.pagesinbook "l" change.case$ " of:} " * * }
  541.       if$
  542.     }
  543.   if$
  544. }
  545.  
  546. FUNCTION {format.in.ed.booktitle}                           %  Achieves effect
  547. { booktitle empty$                                          %  shown in 16.51
  548.     { "" }                                                  %  of Chicago, at
  549.     { editor empty$                                         %  expense of not
  550.         { format.chapter.pages.incoll                       %  achieving effects
  551.           booktitle "t" change.case$ emphasize * }          %  shown in 16.50
  552.         { format.chapter.pages.incoll                       %  of Chicago, on
  553.           format.editors * ", " *                           %  page 189 of
  554.           booktitle "t" change.case$ emphasize * }          %  Butcher and in
  555.       if$                                                   %  4.4 of BS 1629.
  556.     }
  557.   if$
  558. }
  559.  
  560. FUNCTION {format.thesis.type}
  561. { type empty$
  562.     'skip$
  563.     { pop$
  564.       type "t" change.case$
  565.     }
  566.   if$
  567. }
  568.  
  569. FUNCTION {format.tr.number}
  570. { type empty$
  571.     { "Tech. rept."  }                                      %  ODWE abbrevs.
  572.     'type
  573.   if$
  574.   number empty$
  575.     { "t" change.case$ }
  576.     { number tie.or.space.connect }
  577.   if$
  578. }
  579.  
  580. FUNCTION {format.addr.pub}
  581. { publisher empty$
  582.     { "" }
  583.     { address empty$
  584.         { "" }
  585.         { address ": " * }
  586.       if$
  587.       publisher *
  588.     }
  589.   if$
  590. }
  591.  
  592. FUNCTION {format.addr.pub.org}                              %  If there's an
  593. { address empty$                                            %  an organization
  594.   { publisher * ", for " * organization * }                 %  and a publisher
  595.   { address ": " * publisher * ", for " * organization * }  %  too.
  596.   if$
  597. }
  598.  
  599. FUNCTION {format.addr.inst}
  600. { address empty$
  601.   { institution empty$
  602.     { "" }
  603.     { institution }
  604.     if$
  605.   }
  606.   { institution empty$
  607.     { "" }
  608.     { institution ", " * }
  609.     if$
  610.     address *
  611.   }
  612.   if$
  613. }
  614.  
  615. FUNCTION {format.addr.org}
  616. { address empty$
  617.   { organization empty$
  618.     { "" }
  619.     { organization }
  620.     if$
  621.   }
  622.   { organization empty$
  623.     { "" }
  624.     { organization ", " * }
  625.     if$
  626.     address *
  627.   }
  628.   if$
  629. }
  630.  
  631. FUNCTION {format.article.crossref}
  632. { "{\em In:}"
  633.   " \cite{" * crossref * "}" *
  634. }
  635.  
  636. FUNCTION {format.book.crossref}
  637. { volume empty$
  638.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  639.       "{\em In:}"
  640.     }
  641.     { " Vol." volume tie.or.space.connect
  642.       " of " *
  643.     }
  644.   if$
  645.   "\cite{" * crossref * "}" *
  646. }
  647.  
  648. FUNCTION {format.incoll.inproc.crossref}
  649. { "{\em In:}"
  650.   " \cite{" * crossref * "}" *
  651. }
  652.  
  653. FUNCTION {article}
  654. { output.bibitem
  655.   format.authors "author" output.check
  656.   author format.key output
  657.   output.year.check
  658.   new.block
  659.   format.title "title" output.check
  660.   new.block
  661.   crossref missing$
  662.     { journal "t" change.case$ emphasize
  663.       "journal" output.check
  664.       format.vol.num.date.pages output
  665.     }
  666.     { format.article.crossref output.nonnull
  667.       format.pages output
  668.     }
  669.   if$
  670.   new.block
  671.   note output
  672.   fin.entry
  673. }
  674.  
  675. FUNCTION {book}
  676. { output.bibitem
  677.   author empty$
  678.     { format.editors "author and editor" output.check
  679.       editor format.key output
  680.     }
  681.     { format.authors output.nonnull
  682.       crossref missing$
  683.         { "author and editor" editor either.or.check }
  684.         'skip$
  685.       if$
  686.     }
  687.   if$
  688.   output.year.check
  689.   new.block
  690.   format.btitle "title" output.check
  691.   crossref missing$
  692.     { new.sentence
  693.       format.edition output
  694.       new.block
  695.       booklike.series.volume.number output
  696.       new.block
  697.       format.addr.pub "publisher" output.check
  698.     }
  699.     { new.block
  700.       format.book.crossref output.nonnull
  701.     }
  702.   if$
  703.   new.block
  704.   note output
  705.   fin.entry
  706. }
  707.  
  708. FUNCTION {booklet}
  709. { output.bibitem
  710.   format.authors output
  711.   author format.key output
  712.   output.year.month.check
  713.   new.block
  714.   format.btitle "title" output.check
  715.   new.block
  716.   howpublished output
  717.   address output
  718.   new.block
  719.   note output
  720.   fin.entry
  721. }
  722.  
  723. FUNCTION {inbook}
  724. { output.bibitem
  725.   author empty$
  726.     { format.editors "author and editor" output.check
  727.       editor format.key output
  728.     }
  729.     { format.authors output.nonnull
  730.       crossref missing$
  731.         { "author and editor" editor either.or.check }
  732.         'skip$
  733.       if$
  734.     }
  735.   if$
  736.   output.year.check
  737.   new.block
  738.   format.btitle "title" output.check
  739.   crossref missing$
  740.     { new.sentence
  741.       format.edition output
  742.       new.block
  743.       booklike.series.volume.number output
  744.       new.block
  745.       format.addr.pub "publisher" output.check
  746.     }
  747.     { new.block
  748.       format.book.crossref output.nonnull
  749.     }
  750.   if$
  751.   new.block
  752.   note output
  753.   new.block                                                 %  BS 1629 (rather
  754.   format.chapter.pages.inbook "chapter and pages" output.check
  755.   fin.entry                                                 %  than Chicago,
  756. }                                                           %  p. 451)
  757.  
  758. FUNCTION {incollection}
  759. { output.bibitem
  760.   author empty$
  761.     { format.editors "editor" output.check
  762.       editor format.key output             }
  763.     { format.authors "author" output.check
  764.       author format.key output             }
  765.   if$
  766.   output.year.check
  767.   new.block
  768.   format.title "title" output.check
  769.   new.block
  770.   crossref missing$                                         %  Chapter and/or
  771.     { format.in.ed.booktitle output                         %  page numbers can
  772.       format.edition output                                 %  come out via this
  773.       incollectionlike.series.volume.number output          %  route, too.
  774.       new.block
  775.       format.addr.pub "publisher" output.check
  776.     }
  777.     { format.incoll.inproc.crossref output.nonnull
  778.       new.block
  779.     }
  780.   if$
  781.   new.block
  782.   note output
  783.   fin.entry
  784. }
  785.  
  786. FUNCTION {inproceedings}
  787. { output.bibitem
  788.   format.authors "author" output.check
  789.   author format.key output
  790.   publisher empty$
  791.     { output.year.month.check }
  792.     { output.year.check }
  793.   if$
  794.   new.block
  795.   format.title "title" output.check
  796.   new.block
  797.   crossref missing$
  798.     { format.in.ed.booktitle "booktitle" output.check
  799.       incollectionlike.series.volume.number output
  800.       new.block
  801.       publisher empty$
  802.       {
  803.         organization empty$
  804.         'skip$
  805.         { format.addr.org output }
  806.         if$
  807.       }
  808.       {
  809.         organization empty$
  810.         { format.addr.pub output }
  811.         { format.addr.pub.org output }
  812.         if$
  813.       }
  814.       if$
  815.     }
  816.     { format.incoll.inproc.crossref output.nonnull
  817.     }
  818.   if$
  819.   new.block
  820.   note output
  821.   fin.entry
  822. }
  823.  
  824. FUNCTION {conference} { inproceedings }
  825.  
  826. FUNCTION {manual}
  827. { output.bibitem
  828.   format.authors output
  829.   author format.key output
  830.   output.year.month.check
  831.   new.block
  832.   format.btitle "title" output.check
  833.   new.sentence
  834.   format.edition output
  835.   new.block
  836.   organization address new.block.checkb
  837.   format.addr.org output
  838.   new.block
  839.   note output
  840.   fin.entry
  841. }
  842.  
  843. FUNCTION {mastersthesis}
  844. { output.bibitem
  845.   format.authors "author" output.check
  846.   author format.key output
  847.   output.year.month.check
  848.   new.block
  849.   format.btitle "title" output.check
  850.   new.block
  851.   "M.Phil. thesis" format.thesis.type output.nonnull        %  ODWE abbrev.
  852.   school "school" output.check
  853.   address output
  854.   new.block
  855.   note output
  856.   fin.entry
  857. }
  858.  
  859. FUNCTION {misc}
  860. { output.bibitem
  861.   format.authors output
  862.   author format.key output
  863.   output.year.month.check
  864.   new.block
  865.   format.btitle output
  866.   new.block
  867.   howpublished output
  868.   new.block
  869.   note output
  870.   fin.entry
  871. }
  872.  
  873. FUNCTION {phdthesis}
  874. { output.bibitem
  875.   format.authors "author" output.check
  876.   author format.key output
  877.   output.year.month.check
  878.   new.block
  879.   format.btitle "title" output.check
  880.   new.block
  881.   "Ph.D. thesis" format.thesis.type output.nonnull          %  Butcher,
  882.   school "school" output.check                              %  page 174.
  883.   address output
  884.   new.block
  885.   note output
  886.   fin.entry
  887. }
  888.  
  889. FUNCTION {proceedings}
  890. { output.bibitem
  891.   format.editors "author and editor" output.check
  892.   editor format.key output
  893.   publisher empty$
  894.     { output.year.month.check }
  895.     { output.year.check }
  896.   if$
  897.   new.block
  898.   format.btitle "title" output.check
  899.   new.block
  900.   booklike.series.volume.number output
  901.       new.block
  902.       publisher empty$
  903.       {
  904.         organization empty$
  905.         'skip$
  906.         { format.addr.org output }
  907.         if$
  908.       }
  909.       {
  910.         organization empty$
  911.         { format.addr.pub output }
  912.         { format.addr.pub.org output }
  913.         if$
  914.       }
  915.       if$
  916.   new.block
  917.   note output
  918.   fin.entry
  919. }
  920.  
  921. FUNCTION {techreport}
  922. { output.bibitem
  923.   format.authors "author" output.check
  924.   author format.key output
  925.   output.year.month.check
  926.   new.block
  927.   format.btitle "title" output.check
  928.   new.block
  929.   format.tr.number output.nonnull
  930.   new.sentence
  931.   format.addr.inst "institution" output.check
  932.   new.block
  933.   note output
  934.   fin.entry
  935. }
  936.  
  937. FUNCTION {unpublished}
  938. { output.bibitem
  939.   format.authors "author" output.check
  940.   author format.key output
  941.   output.year.month.check
  942.   new.block
  943.   format.btitle "title" output.check
  944.   new.block
  945.   note "note" output.check
  946.   fin.entry
  947. }
  948.  
  949. FUNCTION {default.type} { misc }
  950.  
  951. MACRO {jan} {"Jan."}                                        %  ODWE, "months", &
  952.                                                             %  Chicago, p. 383.
  953. MACRO {feb} {"Feb."}
  954.  
  955. MACRO {mar} {"Mar."}
  956.  
  957. MACRO {apr} {"Apr."}
  958.  
  959. MACRO {may} {"May"}
  960.  
  961. MACRO {jun} {"June"}
  962.  
  963. MACRO {jul} {"July"}
  964.  
  965. MACRO {aug} {"Aug."}
  966.  
  967. MACRO {sep} {"Sept."}
  968.  
  969. MACRO {oct} {"Oct."}
  970.  
  971. MACRO {nov} {"Nov."}
  972.  
  973. MACRO {dec} {"Dec."}
  974.  
  975. MACRO {acmcs} {"ACM Computing Surveys"}
  976.  
  977. MACRO {acta} {"Acta Informatica"}
  978.  
  979. MACRO {cacm} {"Communications of the ACM"}
  980.  
  981. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  982.  
  983. MACRO {ibmsj} {"IBM Systems Journal"}
  984.  
  985. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  986.  
  987. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  988.  
  989. MACRO {ieeetcad}
  990.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  991.  
  992. MACRO {ipl} {"Information Processing Letters"}
  993.  
  994. MACRO {jacm} {"Journal of the ACM"}
  995.  
  996. MACRO {jcss} {"Journal of Computer and System Sciences"}
  997.  
  998. MACRO {scp} {"Science of Computer Programming"}
  999.  
  1000. MACRO {sicomp} {"SIAM Journal on Computing"}
  1001.  
  1002. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1003.  
  1004. MACRO {tods} {"ACM Transactions on Database Systems"}
  1005.  
  1006. MACRO {tog} {"ACM Transactions on Graphics"}
  1007.  
  1008. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1009.  
  1010. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1011.  
  1012. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1013.  
  1014. MACRO {tcs} {"Theoretical Computer Science"}
  1015.  
  1016. READ
  1017.  
  1018. FUNCTION {sortify}
  1019. { purify$
  1020.   "l" change.case$
  1021. }
  1022.  
  1023. INTEGERS { len }
  1024.  
  1025. FUNCTION {chop.word}
  1026. { 's :=
  1027.   'len :=
  1028.   s #1 len substring$ =
  1029.     { s len #1 + global.max$ substring$ }
  1030.     's
  1031.   if$
  1032. }
  1033.  
  1034. FUNCTION {format.lab.names}
  1035. { 's :=
  1036.   s #1 "{vv~}{ll}" format.name$
  1037.   s num.names$ duplicate$
  1038.   #2 >
  1039.     { pop$ " {\em et~al.}" * }
  1040.     { #2 <
  1041.         'skip$
  1042.         { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1043.             { " {\em et~al.}" * }
  1044.             { " \& " * s #2 "{vv~}{ll}" format.name$ * }
  1045.           if$
  1046.         }
  1047.       if$
  1048.     }
  1049.   if$
  1050. }
  1051.  
  1052. FUNCTION {author.key.label}
  1053. { author empty$
  1054.     { key empty$
  1055.         { cite$ #1 #3 substring$ }
  1056.         'key
  1057.       if$
  1058.     }
  1059.     { author format.lab.names }
  1060.   if$
  1061. }
  1062.  
  1063. FUNCTION {author.editor.key.label}
  1064. { author empty$
  1065.     { editor empty$
  1066.         { key empty$
  1067.             { cite$ #1 #3 substring$ }
  1068.             'key
  1069.           if$
  1070.         }
  1071.         { editor format.lab.names }
  1072.       if$
  1073.     }
  1074.     { author format.lab.names }
  1075.   if$
  1076. }
  1077.  
  1078. FUNCTION {editor.key.label}
  1079. { editor empty$
  1080.     { key empty$
  1081.         { cite$ #1 #3 substring$ }
  1082.         'key
  1083.       if$
  1084.     }
  1085.     { editor format.lab.names }
  1086.   if$
  1087. }
  1088.  
  1089. FUNCTION {calc.label}
  1090.   { type$ "book" =
  1091.     type$ "inbook" =
  1092.     type$ "incollection" =                                  %  For sensible
  1093.   or or                                                     %  treatment of
  1094.     'author.editor.key.label                                %  Singer in
  1095.     { type$ "proceedings" =                                 %  BS 1629.
  1096.         'editor.key.label
  1097.         'author.key.label
  1098.       if$
  1099.     }
  1100.   if$
  1101.   duplicate$
  1102.   year empty$
  1103.   {
  1104.     "\protect\citename{" swap$ * ", }" *
  1105.     "n.d." * 'label :=                                      %  Chicago,
  1106.   }                                                         %  page 457.
  1107.   {
  1108.     "\protect\citename{" swap$ * ", }" *
  1109.     year
  1110.     *
  1111.     'label :=
  1112.   }
  1113.   if$
  1114.   year field.or.null purify$ *
  1115.   sortify 'sort.label :=
  1116. }
  1117.  
  1118.  
  1119. FUNCTION {sort.format.names}                                %  To produce the
  1120. { 's :=                                                     %  order of entries
  1121.   #1 'nameptr :=                                            %  specified in item
  1122.   ""                                                        %  (3) on page 187
  1123.   s num.names$ 'numnames :=                                 %  of Butcher.
  1124.   numnames 'namesleft :=
  1125.     { namesleft #0 > nameptr #3 < and }                     %  Only 1st 2 names
  1126.     { nameptr #1 >                                          %  matter for
  1127.         { "   " * }                                         %  sorting.
  1128.         'skip$
  1129.       if$                                                   %  Anything that's
  1130.       nameptr #2 = numnames #2 > and                        %  "et al" goes
  1131.       { "zzzzz" * }                                         %  after works by 2
  1132.       {                                                     %  authors.
  1133.         s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  1134.         nameptr numnames = t "others" = and
  1135.           { "zzzzz" * }
  1136.           { t sortify * }
  1137.         if$
  1138.       }
  1139.       if$
  1140.       nameptr #1 + 'nameptr :=
  1141.       namesleft #1 - 'namesleft :=
  1142.     }
  1143.   while$
  1144. }
  1145.  
  1146. FUNCTION {sort.format.title}
  1147. { 't :=
  1148.   "A " #2
  1149.     "An " #3
  1150.       "The " #4 t chop.word
  1151.     chop.word
  1152.   chop.word
  1153.   sortify
  1154.   #1 global.max$ substring$
  1155. }
  1156.  
  1157. FUNCTION {author.sort}
  1158. { author empty$
  1159.     { key empty$
  1160.         { "to sort, need author or key in " cite$ * warning$
  1161.           ""
  1162.         }
  1163.         { key sortify }
  1164.       if$
  1165.     }
  1166.     { author sort.format.names }
  1167.   if$
  1168. }
  1169.  
  1170. FUNCTION {author.editor.sort}
  1171. { author empty$
  1172.     { editor empty$
  1173.         { key empty$
  1174.             { "to sort, need author, editor, or key in " cite$ * warning$
  1175.               ""
  1176.             }
  1177.             { key sortify }
  1178.           if$
  1179.         }
  1180.         { editor sort.format.names }
  1181.       if$
  1182.     }
  1183.     { author sort.format.names }
  1184.   if$
  1185. }
  1186.  
  1187. FUNCTION {editor.sort}
  1188. { editor empty$
  1189.     { key empty$
  1190.         { "to sort, need editor or key in " cite$ * warning$
  1191.           ""
  1192.         }
  1193.         { key sortify }
  1194.       if$
  1195.     }
  1196.     { editor sort.format.names }
  1197.   if$
  1198. }
  1199.  
  1200. FUNCTION {presort}                                          %  Two sorting
  1201. { calc.label                                                %  passes, from
  1202.   label sortify                                             %  apalike.bst.
  1203.   "    "
  1204.   *
  1205.   type$ "book" =
  1206.   type$ "inbook" =
  1207.   type$ "incollection" =                                    %  For Singer
  1208.   or or                                                     %  in BS 1629.
  1209.     'author.editor.sort
  1210.     { type$ "proceedings" =
  1211.         'editor.sort
  1212.         'author.sort
  1213.       if$
  1214.     }
  1215.   if$
  1216.   #1 entry.max$ substring$
  1217.   'sort.label :=
  1218.   sort.label
  1219.   *
  1220.   "    "
  1221.   *
  1222.   title field.or.null
  1223.   sort.format.title
  1224.   *
  1225.   #1 entry.max$ substring$
  1226.   'sort.key$ :=
  1227. }
  1228.  
  1229. ITERATE {presort}
  1230.  
  1231. SORT
  1232.  
  1233. STRINGS { last.label next.extra }
  1234.  
  1235. INTEGERS { last.extra.num }
  1236.  
  1237. FUNCTION {initialize.extra.label.stuff}
  1238. { #0 int.to.chr$ 'last.label :=
  1239.   "" 'next.extra :=
  1240.   #0 'last.extra.num :=
  1241. }
  1242.  
  1243. FUNCTION {forward.pass}
  1244. { last.label label =
  1245.     { last.extra.num #1 + 'last.extra.num :=
  1246.       last.extra.num int.to.chr$ 'extra.label :=
  1247.     }
  1248.     { "a" chr.to.int$ 'last.extra.num :=
  1249.       "" 'extra.label :=
  1250.       label 'last.label :=
  1251.     }
  1252.   if$
  1253. }
  1254.  
  1255. FUNCTION {reverse.pass}
  1256. { next.extra "b" =
  1257.     { "a" 'extra.label := }
  1258.     'skip$
  1259.   if$                                                       %  Code needed here
  1260.                                                             %  if \citeauthor
  1261.                                                             %  and \citeyear
  1262.   label extra.label * 'label :=                             %  were supported.
  1263.   extra.label 'next.extra :=
  1264. }
  1265.  
  1266. EXECUTE {initialize.extra.label.stuff}
  1267.  
  1268. ITERATE {forward.pass}
  1269.  
  1270. REVERSE {reverse.pass}
  1271.  
  1272. FUNCTION {bib.sort.order}
  1273. { sort.label
  1274.   "    "
  1275.   *
  1276.   year field.or.null sortify
  1277.   *
  1278.   "    "
  1279.   *
  1280.   title field.or.null
  1281.   sort.format.title
  1282.   *
  1283.   #1 entry.max$ substring$
  1284.   'sort.key$ :=
  1285. }
  1286.  
  1287. ITERATE {bib.sort.order}
  1288.  
  1289. SORT
  1290.  
  1291. FUNCTION {begin.bib}
  1292. { preamble$ empty$
  1293.     'skip$
  1294.     { preamble$ write$ newline$ }
  1295.   if$
  1296.   "\begin{thebibliography}{}" write$ newline$
  1297. }
  1298.  
  1299. EXECUTE {begin.bib}
  1300.  
  1301. EXECUTE {init.state.consts}
  1302.  
  1303. ITERATE {call.type$}
  1304.  
  1305. FUNCTION {end.bib}
  1306. { newline$
  1307.   "\end{thebibliography}" write$ newline$
  1308. }
  1309.  
  1310. EXECUTE {end.bib}
  1311.